---
layout: default
title: Snippets
---

<ul style="position:absolute;left:-9999px;">
{% for item in site.pages %}<li><a href="#!{{ item.url }}">{{ item.title }}</a></li>
<li><a href="{{ item.url }}">{{ item.title }}</a></li>
{% endfor %}
</ul>

<span href="{{site.new_path}}" class="add-snippet" target="_blank">+<b>添加 Snippet</b></span>
<div class="search-mask"><i class="icon search-close" title="关闭">&#xe624;</i></div>
<div class="codeTypes" id="codeTypes"></div>
<div class="codePreview" id="codePreview">
  <div class="search">
    <span class="search-info"></span>
    <input type="text" placeholder="按 Enter 展示结果" id="q" name="q" autocomplete="false" />
  </div>
	<div class="typeList" id="typeList"></div>
	<div class="codebox" id="codebox" data-baseurl="{{site.edit_path}}">
		<i class="icon close" id="close" title="关闭预览">&#xe624;</i>
    <a class="icon pen" title="编辑代码" href="#" target="_blank">&#xe601;</a>
    <a href="javascript:var d=document;var b=d.body;if(b&&!document.xmlVersion){if(!d.getElementById('bsBox')){void(y=document.createElement('script'));void(y.src='http://static.bshare.cn/b/bookmark.js#lang=zh');void(b.appendChild(y));}else{bShare.show();}}" class="icon share" title="分享网页">&#xe60c;</a>
		<div class="code" id="code">
      <i class="icon close" id="close">&#xe624;</i>
      <div class="codectt" id="codectt"></div>
    </div>
	</div>
</div>
<!--<div class="commitCode" id="commitCode">
  <iframe style="display:none;" id="ifr" name="ifr"></iframe>
  <form method="post" target="ifr" id="commitForm" class="commitForm"
    action="http://snippet-be.coding.io/post" enctype="multipart/form-data">
    <p>
      <span>
        <label for="f_title">标题: </label>
        <input type="text" name="title" if="f_title" placeholder="Snippet的标题（必填）" required />
      </span>
      <span class="fselect">
        <label for="f_type">类型: </label>
        <select name="type" id="f_type" required>
          <option value="">--选择类型--</option>
        </select>
        <input type="text" name="type" id="f_type_other" value="" placeholder="其他类型" />
      </span>
    </p>
    <p>
      <span>
        <label for="f_author">作者: </label>
        <input type="text" name="author" id="f_author" placeholder="您的大名（必填）" required />
      </span>
      <span>
        <label for="f_email">邮箱: </label>
        <input type="text" name="email" id="f_email" placeholder="您的邮箱（必填）" required />
      </span>
    </p>
    <textarea name="content" id="f_content" required placeholder='使用 markdown 编写，代码要放到 "``` code ```" 中!'>
使用 markdown 编写，代码要这样放：

```
code
```

提交审核通过之后就会展示在这里啦！

P.S：如果点击提交木有反应，应该是后端程序挂了，您可以点击右上角的 fork 按钮，fork 代码之后提 PR。
    </textarea>
    <input type="submit" value="提交" id="f_submit" /><b class="info">info</b>
  </form>
</div>
-->

<script>
var snippets = [
{% for item in site.pages %}{% assign type = item.dir | split: "/" %}  {% if type != '/' %}{ type: "{{ type[2] }}", title: "{{ item.title }}", url: "{{ item.url }}" },{% endif %}
{% endfor %}{}].slice(0, -1);
</script>
